package com.csw.shuanfa.CodeImprove.CompleteFutureLinkedBlockingQueue.RequestMergeLinkedBlockingQueue;


import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

@Service
public class QueryServiceRemoteCall {
    /**
     * 模拟从数据库查询
     *
     * @param codes
     * @return
     */
    public Map<String, HashMap<String, Object>> queryCommodityByCodeBatch(List<String> codes) {
        Map<String, HashMap<String, Object>> result = new HashMap();
        for (String code : codes) {
            HashMap<String, Object> hashMap = new HashMap<>();
            hashMap.put("commodityId", new Random().nextInt(999999999));
            hashMap.put("code", code);
            hashMap.put("phone", "huawei");
            hashMap.put("isOk", "true");
            hashMap.put("price", "4000");
            result.put(code, hashMap);
        }
        return result;
    }
}
